package com.corticon.dialogs.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;


/**
 * Discount entity.
 *
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "discount")
public class Discount extends AuditableEntity implements Serializable {

    private Long discountId;
    private LoanType loanType;
    private Long amount;
    private String id;

    public Discount() {
    }

    @Id
    @SequenceGenerator(name = "discount_id_seq",
            sequenceName = "discount_id_seq",
            allocationSize = 1, initialValue = 1)
    // Set allocationSize and initialValue
    // to let sequence increment following DB.)
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "discount_id_seq")
    @Column(name = "discount_id",  nullable = false, columnDefinition = "integer")
    public Long getDiscountId() {
        return this.discountId;
    }

    public void setDiscountId(Long discountId) {
        this.discountId = discountId;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "loantypeassoc_loantype_id_oid")
    public LoanType getLoanType() {
        return this.loanType;
    }

    public void setLoanType(LoanType loanType) {
        this.loanType = loanType;
    }

    @Column(name = "amount", columnDefinition = "numeric")
    public Long getAmount() {
        return this.amount;
    }

    public void setAmount(Long amount) {
        this.amount = amount;
    }

    @Column(name = "id", length = 256)
    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }
}